home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / devel / libx11 / include / x11 / xmu / displayque.h < prev    next >
C/C++ Source or Header  |  1999-01-01  |  5KB  |  163 lines

  1. /* $XConsortium: DisplayQue.h,v 1.5 91/07/22 23:45:45 converse Exp $
  2.  *
  3.  * Copyright 1989 Massachusetts Institute of Technology
  4.  *
  5.  * Permission to use, copy, modify, distribute, and sell this software and its
  6.  * documentation for any purpose is hereby granted without fee, provided that
  7.  * the above copyright notice appear in all copies and that both that
  8.  * copyright notice and this permission notice appear in supporting
  9.  * documentation, and that the name of M.I.T. not be used in advertising or
  10.  * publicity pertaining to distribution of the software without specific,
  11.  * written prior permission.  M.I.T. makes no representations about the
  12.  * suitability of this software for any purpose.  It is provided "as is"
  13.  * without express or implied warranty.
  14.  *
  15.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  16.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  17.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  19.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  20.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  *
  22.  */
  23.  
  24. #ifndef _XMU_DISPLAYQUE_H_
  25. #define _XMU_DISPLAYQUE_H_
  26.  
  27. #include <X11/Xmu/CloseHook.h>
  28. #include <X11/Xfuncproto.h>
  29.  
  30. /*
  31.  *                  Public Entry Points
  32.  * 
  33.  * 
  34.  * XmuDisplayQueue *XmuDQCreate (closefunc, freefunc, data)
  35.  *     XmuCloseDisplayQueueProc closefunc;
  36.  *     XmuFreeDisplayQueueProc freefunc;
  37.  *     caddr_t data;
  38.  * 
  39.  *         Creates and returns a queue into which displays may be placed.  When
  40.  *         the display is closed, the closefunc (if non-NULL) is upcalled with
  41.  *         as follows:
  42.  *
  43.  *                 (*closefunc) (queue, entry)
  44.  *
  45.  *         The freeproc, if non-NULL, is called whenever the last display is
  46.  *         closed, notifying the creator that display queue may be released
  47.  *         using XmuDQDestroy.
  48.  *
  49.  *
  50.  * Bool XmuDQDestroy (q, docallbacks)
  51.  *     XmuDisplayQueue *q;
  52.  *     Bool docallbacks;
  53.  * 
  54.  *         Releases all memory for the indicated display queue.  If docallbacks
  55.  *         is true, then the closefunc (if non-NULL) is called for each 
  56.  *         display.
  57.  * 
  58.  * 
  59.  * XmuDisplayQueueEntry *XmuDQLookupDisplay (q, dpy)
  60.  *     XmuDisplayQueue *q;
  61.  *     Display *dpy;
  62.  *
  63.  *         Returns the queue entry for the specified display or NULL if the
  64.  *         display is not in the queue.
  65.  *
  66.  * 
  67.  * XmuDisplayQueueEntry *XmuDQAddDisplay (q, dpy, data)
  68.  *     XmuDisplayQueue *q;
  69.  *     Display *dpy;
  70.  *     caddr_t data;
  71.  *
  72.  *         Adds the indicated display to the end of the queue or NULL if it
  73.  *         is unable to allocate memory.  The data field may be used by the
  74.  *         caller to attach arbitrary data to this display in this queue.  The
  75.  *         caller should use XmuDQLookupDisplay to make sure that the display
  76.  *         hasn't already been added.
  77.  * 
  78.  * 
  79.  * Bool XmuDQRemoveDisplay (q, dpy)
  80.  *     XmuDisplayQueue *q;
  81.  *     Display *dpy;
  82.  *
  83.  *         Removes the specified display from the given queue.  If the 
  84.  *         indicated display is not found on this queue, False is returned,
  85.  *         otherwise True is returned.
  86.  */
  87.  
  88. typedef struct _XmuDisplayQueue XmuDisplayQueue;
  89. typedef struct _XmuDisplayQueueEntry XmuDisplayQueueEntry;
  90.  
  91. typedef int (*XmuCloseDisplayQueueProc)(
  92. #if NeedFunctionPrototypes
  93.     XmuDisplayQueue*        /* queue */,
  94.     XmuDisplayQueueEntry*    /* entry */
  95. #endif
  96. );
  97.  
  98. typedef int (*XmuFreeDisplayQueueProc)(
  99. #if NeedFunctionPrototypes
  100.     XmuDisplayQueue*        /* queue */
  101. #endif
  102. );
  103.  
  104. struct _XmuDisplayQueueEntry {
  105.     struct _XmuDisplayQueueEntry *prev, *next;
  106.     Display *display;
  107.     CloseHook closehook;
  108.     caddr_t data;
  109. };
  110.  
  111. struct _XmuDisplayQueue {
  112.     int nentries;
  113.     XmuDisplayQueueEntry *head, *tail;
  114.     XmuCloseDisplayQueueProc closefunc;
  115.     XmuFreeDisplayQueueProc freefunc;
  116.     caddr_t data;
  117. };
  118.  
  119. _XFUNCPROTOBEGIN
  120.  
  121. extern XmuDisplayQueue *XmuDQCreate(
  122. #if NeedFunctionPrototypes
  123.     XmuCloseDisplayQueueProc    /* closefunc */,
  124.     XmuFreeDisplayQueueProc    /* freefunc */,
  125.     caddr_t    /* data */
  126. #endif
  127. );
  128.  
  129. extern Bool XmuDQDestroy(
  130. #if NeedFunctionPrototypes
  131.     XmuDisplayQueue*    /* q */,
  132.     Bool        /* docallbacks */
  133. #endif
  134. );
  135.  
  136. extern XmuDisplayQueueEntry *XmuDQLookupDisplay(
  137. #if NeedFunctionPrototypes
  138.     XmuDisplayQueue*    /* q */,
  139.     Display*        /* dpy */
  140. #endif
  141. );
  142.  
  143. extern XmuDisplayQueueEntry *XmuDQAddDisplay(
  144. #if NeedFunctionPrototypes
  145.     XmuDisplayQueue*    /* q */,
  146.     Display*        /* dpy */,
  147.     caddr_t        /* data */
  148. #endif
  149. );
  150.  
  151. extern Bool XmuDQRemoveDisplay(
  152. #if NeedFunctionPrototypes
  153.     XmuDisplayQueue*    /* q */,
  154.     Display*        /* dpy */
  155. #endif
  156. );
  157.  
  158. _XFUNCPROTOEND
  159.  
  160. #define XmuDQNDisplays(q) ((q)->nentries)
  161.  
  162. #endif /* _XMU_DISPLAYQUE_H_ */
  163.